/*******************************************************************************
 * Copyright 2007 NetCom. All rights reserved.
 ******************************************************************************/

package com.dailydev.jira.portal;

import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.util.GroupPermissionCheckerImpl;
import com.opensymphony.user.EntityNotFoundException;
import com.opensymphony.user.User;
import com.opensymphony.user.UserManager;

/**
 * @author robo9109
 * 
 */
public class JiraFacade implements IJiraFacade {

    private GroupPermissionCheckerImpl groupPermissionChecker;

    private UserManager userManager;

    /**
     * 
     */
    public JiraFacade() {
        groupPermissionChecker = new GroupPermissionCheckerImpl(
                ComponentManager.getInstance().getPermissionManager());
        userManager = UserManager.getInstance();
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.dailydev.jira.portal.IJiraFacade#getUser(java.lang.String)
     */
    public User getUser(String userName) throws EntityNotFoundException {
        return userManager.getUser(userName);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.dailydev.jira.portal.IJiraFacade#hasViewGroupPermission(java.lang.String,
     *      com.opensymphony.user.User)
     */
    public boolean hasViewGroupPermission(String groupName, User user) {
        return groupPermissionChecker.hasViewGroupPermission(groupName, user);
    }

}
